jun.SecurityRolesWin = Ext.extend(Ext.Window, {
    title: "Security Role",
    modez: 1,
    width: 500,
    height: 500,
    layout: "form",
    modal: !0,
    padding: 3,
    resizable: !1,
    closeForm: !1,
    iswin: !0,
    initComponent: function () {
        this.items = [
            {
                xtype: "form",
                frame: !1,
                bodyStyle: "padding: 10px",
                id: "form-SecurityRoles",
                labelWidth: 100,
                labelAlign: "left",
                layout: "accordion",
                ref: "formz",
                border: !1,
                anchor: "100% 100%",
                items: [
                    {
                        xtype: "panel",
                        title: "Description",
                        layout: "form",
                        bodyStyle: "padding: 10px",
                        items: [
                            {
                                xtype: "textfield",
                                fieldLabel: "Role Name",
                                hideLabel: !1,
                                name: "role",
                                id: "roleid",
                                ref: "../role",
                                maxLength: 30,
                                anchor: "100%"
                            },
                            {
                                xtype: "textarea",
                                fieldLabel: "Description",
                                hideLabel: !1,
                                name: "ket",
                                id: "ketid",
                                ref: "../ket",
                                maxLength: 255,
                                anchor: "100%"
                            }
                        ]
                    },
                    {
                        xtype: "panel",
                        title: "Section",
                        layout:'column',
                        bodyStyle: "padding: 10px;",
                        defaultType: "checkbox",
                        items: [
                            {
                                columnWidth: .5,
                                boxLabel: "PENJUALAN 1",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "100"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "PENJUALAN 2",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "101"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "PENJUALAN 3",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "102"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "PENJUALAN 4",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "103"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "GUDANG",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "118"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "MASTER 1",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "104"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "MASTER 2",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "105"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "MASTER 3",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "106"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "MASTER 4",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "107"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "MASTER 5",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "116"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "PEMBELIAN 1",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "108"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "PEMBELIAN 2",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "109"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "PEMBELIAN 3",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "110"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "PEMBELIAN 4",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "111"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "PEMBELIAN 5",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "119"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "SALDO AWAL",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "117"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "KAS KECIL",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "112"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "KAS BESAR",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "113"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "ACCOUNTING",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "114"
                            },
                            {
                                columnWidth: .5,
                                boxLabel: "ADMINISTRASI",
                                value: 0,
                                inputValue: 1,
                                uncheckedValue: 0,
                                name: "115"
                            }
                        ]
                    },
                    new Ext.Panel({
                        title:'Keterangan',
                        bodyStyle: "padding: 10px;",
                        anchor:'100% 80%',
                        layout: 'anchor',
                        autoScroll: true,
                        html:"<b>PENJUALAN 1:</b><br>" +
                             "Transaksi Penjualan (Tambah Faktur, Edit Faktur)<br>" +
                             "Cat: Edit Faktur berarti termasuk print screen Retur Pebjualan dan Botol per Konsumen<br>" +
                             "<b>PENJUALAN 2:</b><br>" +
                             "Laporan Penjualan, Daftar Piutang, Piutang per Salesman<br>" +
                             "<b>PENJUALAN 3:</b><br>" +
                             "Transaksi Penjualan lainnya, seperti: Setoran Kas, Botol per Salesman.<br>" +
                             "<b>PENJUALAN 4:</b><br>" +
                             "Laporan Biaya per Salesman, Laba Kotor per Salesman, Botol per Salesman<br>" +
                             "<b>GUDANG:</b><br>" +
                             "DO Sementara dan DO Final.<br>" +
                             "<b>MASTER 1:</b><br>" +
                             "Master Konsumen, Pasar, Area<br>" +
                             "<b>MASTER 2:</b><br>" +
                             "Master Barang<br>" +
                             "<b>MASTER 3:</b><br>" +
                             "Master Karyawan<br>" +
                             "<b>MASTER 4:</b><br>" +
                             "Master Kas dan Bank, Kode Rekening<br>" +
                             "<b>PEMBELIAN 1:</b><br>" +
                             "Pesanan, Retur Pembelian<br>" +
                             "<b>PEMBELIAN 2:</b><br>" +
                             "Laporan Barang sedang dipesan, Barang mencapai titik minimal, pembelian<br>" +
                             "<b>PEMBELIAN 3:</b><br>" +
                             "Faktur Pembelian, Pelunasan Utang, Nota Debet<br>" +
                             "<b>PEMBELIAN 4:</b><br>" +
                             "Laporan Nota Debet, Utang<br>" +
                             "<b>PEMBELIAN 5:</b><br>" +
                             "Penerimaan Barang<br>" +
                             "<b>KAS KECIL:</b><br>" +
                             "Kas Kecil Masuk, Kas Kecil Keluar, Laporan Mutasi Kas Kecil<br>" +
                             "<b>KAS BESAR:</b><br>" +
                             "Kas Masuk, Kas Keluar, Laporan Mutasi Semua Jenis Kas<br>" +
                             "<b>ACCOUNTING:</b><br>" +
                             "Jurnal Umum, Pengelolaan Persediaan,Selisih Persediaan, Laporan Terkait Persediaan<br>"+
                             "<b>ADMINISTRASI:</b><br>" +
                             "Management User, Security Role<br>"
                    })
                ]
            }
        ];
        this.fbar = {
            xtype: "toolbar",
            items: [
                {
                    xtype: "button",
                    text: "Save & Close",
                    ref: "../btnSaveClose"
                },
                {
                    xtype: "button",
                    text: "Close",
                    ref: "../btnCancel"
                }
            ]
        };
        jun.SecurityRolesWin.superclass.initComponent.call(this);
        this.on("activate", this.onActivate, this);
        this.btnSaveClose.on("click", this.onbtnSaveCloseClick, this);
//        this.btnSave.on("click", this.onbtnSaveclick, this);
        this.btnCancel.on("click", this.onbtnCancelclick, this);
    },
    btnDisabled: function (a) {
        this.btnSaveClose.setDisabled(a);
    },
    onActivate: function () {
        this.btnSaveClose.hidden = !1;
    },
    saveForm: function () {
        this.btnDisabled(!0);
        var a;
        this.modez == 1 || this.modez == 2 ? a = "SecurityRoles/update/id/" + this.id : a = "SecurityRoles/create/",
            Ext.getCmp("form-SecurityRoles").getForm().submit({
                url: a,
                timeOut: 1e3,
                scope: this,
                success: function (a, b) {
                    jun.rztSecurityRoles.reload();
                    jun.sidebar.getRootNode().reload();
                    var c = Ext.decode(b.response.responseText);
                    this.close();
//                    this.closeForm ? this.close() : (c.data != undefined && Ext.MessageBox.alert("Pelayanan", c.data.msg),
//                        this.modez == 0 && Ext.getCmp("form-SecurityRoles").getForm().reset());
                },
                failure: function (a, b) {
                    Ext.MessageBox.alert("Error", "Can't Communicate With The Server");
                    this.btnDisabled(!1);
                }
            });
    },
    onbtnSaveCloseClick: function () {
        this.closeForm = !0, this.saveForm(!0);
    },
    onbtnSaveclick: function () {
        this.closeForm = !1, this.saveForm(!1);
    },
    onbtnCancelclick: function () {
        this.close();
    }
});